home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 5.1 KB | 146 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Misc.Lib
- #
- # Contains: xxx put contents here xxx
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.11> 12/13/93 KTA Changed name of CenterOfScreenClick() to CenterOfRectClick() and
- # added support for different types of rects.
- # <1.0.10> 12/2/93 KTA Updated output
- # <1.0.9> 12/2/93 KTA Deleted the task DoSpecialTest() it was replaced with hooks.
- # Fixed problem where AboutBox() was not reporting any problems if
- # window did not appear.
- # <1.0.7+> 11/19/93 NAGA modify TCS format
- # <1.0.7> 8/25/93 KTA Added support for parity checking the TCS stack.
- # <1.0.6> 7/19/93 KTA Updates for FindWindow() to handle descriptors.
- # <1.0.5> 7/14/93 KTA International Support: See AboutBox().
- # <1+> 5/21/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "OutPut.Lib","LaunchQuit.Lib","TCS.Lib","UserInterface.Lib", "Geometry.Lib";
-
-
- #########################################################################
- # CenterofRectClick(pSpecifier)
- #=======================================================================
- # Author: KTA
- # Description: Clicks in the center of the input parameter <pSpecifier>
- # Parameters: pSpecifier
- # -1 - indicates the screen
- # integer <> -1 (or string) is a window specifier
- # list - should be valid rectangle
- # Returns: Nada
- #=======================================================================
- # History:
- # KTA 12/13/93 Changed the name from CenterofScreenClick and added ability
- # to specifiy different types of Rects
- #########################################################################
- TASK CenterofRectClick(pSpecifier := -1)
- begin
- parameterType := TypeOf(pSpecifier);
- if(parameterType = 'integer') or (parameterType = 'string')
- begin
- if(pSpecifier = -1)
- begin
- Match[screen r:?ScreenRect m:true];
- myPoint := CenterPointOfRect(ScreenRect);
- theDescriptor := 'the screen';
- end;
- else
- begin
- theWind := findWindow(pSpecifier);
- theWindowRect := theWind.r;
- theWindowTitle := theWind.t;
- myPoint := CenterPointOfRect(theWindowRect);
- theDescriptor := "the window titled '{theWindowTitle}'";
- end;
- end;
- if(parameterType = 'list') and (Card(pSpecifier) = 4)
- begin
- myPoint := CenterPointOfRect(pSpecifier);
- theDescriptor := "the rect ({pSpecifier})";
- end;
-
-
- move a:myPoint;
- click;
- LogStr("Moved to the center of {theDescriptor} and clicked");
- end; # CenterofRectClick()
-
-
- #########################################################################
- # AboutBox(pDismissAboutBox)
- #=======================================================================
- # Author: ML
- # Description: Test the About Box
- # Parameters: pDismissAboutBox - 0 Return key
- # integer > 0 Click in center of screen {integer} times
- # {string} select button named {string}
- # Returns: 0 - Something failed
- # 1 - Successfully selected and dismissed the about box.
- #=======================================================================
- # History:
- # KTA 7/8/93 Changed check for About… menuItem to selectMenuItem(1,1); - intl
- # KTA 7/19/93 Changed descriptor so it is not embedded in a list.
- # KTA 8/24/93 TCS stack parity check
- # KTA 12/01/93 Check to make sure window appears (bug 1121683)
- ########################################################################
- TASK AboutBox(pDismissAboutBox := 0)
- begin
- tcReturnVal := 0;
- failStr := '';
- #match[menuItem t:?AboutItem o:1 m:[menu o:1]]!;
- theFrontWindow := match[window o:1]!;
- TCSStart({ 1, global kTCSetAboutBox },"Select 'About...'");
-
- returnVal := SelectMenuItem(1,1);
- wait(2);
- AboutBoxWindow:= match[window o:1]!;
- if (theFrontWindow = AboutBoxWindow)
- begin
- tcReturnVal := 0;
- failStr := "!@#$% The 'About Box' did not appear";
- LogStr(failStr);
- end;
- else if (returnVal)
- tcReturnVal := 1;
-
- TCSEnd({ 1, global kTCSetAboutBox },tcReturnVal, failStr); # Select the 'About…' window
-
- if(tcReturnVal)
- begin
- TCSStart({ 2, global kTCSetAboutBox },"Dismiss About Box");
- if pDismissAboutBox = 0
- SpecialKey(returnKey , "Return Key");
- else if (TypeOf(pDismissAboutBox) = 'string')
- selectButton(pDismissAboutBox);
- else if TypeOf(pDismissAboutBox) = 'integer'
- for x:= 1 to pDismissAboutBox
- CenterofRectClick();
-
- if not FindWindow(AboutBoxWindow)
- tcReturnVal := 1;
- else
- tcReturnVal := 0;
-
- TCSEnd({ 2, global kTCSetAboutBox },tcReturnVal);
- end;
- return(tcReturnVal);
- end;
-